package com.last1mile.dao.ibatis.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.last1mile.dao.BaseSqlMapClientDao;
import com.last1mile.dao.interfaces.TradeDao;
import com.last1mile.pojo.TradeDO;

@Component("tradeDao")
public class TradeDaoImpl extends BaseSqlMapClientDao implements TradeDao {

    @Override
    public Integer inserTrade(TradeDO tradeDo) {
        return (Integer) getSqlMapClientTemplate().insert("trade.insertTrade", tradeDo);
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<TradeDO> queryTradeByPerId(Integer perId) {
        List<TradeDO> records = (List<TradeDO>) getSqlMapClientTemplate().queryForList("trade.selectByPerId", perId);
        return records;
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<TradeDO> queryTradeByMerId(Integer merId) {
        List<TradeDO> records = (List<TradeDO>) getSqlMapClientTemplate().queryForList("trade.selectByMerId", merId);
        return records;
    }

}
